This invention is related to data processing, and more specifically, to data consistency maintenance for sequential requests.
In network-based applications such as web applications, user data may be fetched frequently. However, the user data may not be updated or changed as frequently. Therefore, the user data is stored in data caches to speed up the retrieval of the user data. In one scenario, a cluster of servers each have their own data cache for accessing user data. Several data requests may be sent out from a client to the servers in a relatively short time, including a write request and a subsequent read request of the data. For example, a distributed server network provides an e-commerce platform for user to purchase items. A user may add one item to his or her shopping cart in a client application. As a result, the client may send a write request to update order information and then send a read request to obtain some information related to the updated order information to be displayed on the client. In a distributed or cloud computing environment, the write request and the read request may be directed to different servers. In such a situation, the caches of both servers may not be in sync when the requests are received. Typically to synchronize caches, the section of a cache with out-of-sync data is invalidated (e.g., cache invalidation) and rewritten with the correct current data. However, in high traffic volume environments, cache invalidation may not be completed on all of the backend servers due to the relatively short time between the data requests. Therefore, the latter read request may not be able to get the latest information updated by the former write request. One existing solution for such problem is referred to “session affinity”, which is a mechanism to make sure that multiple requests from a same session be handled by the same server. However, this mechanism may introduce limitations and difficulties in scalability to distributed systems as well as overall throughput of the system.